package com.auxgroup.smarthome.dto;


import com.auxgroup.smarthome.entity.UserEntity;
import com.auxgroup.smarthome.regex.ValidatorUtils;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.Pattern;

/**
 * 修改个人中心
 */
public class UpdatePersonCenterDto {

    @NotEmpty(message = "真实姓名不能为空")
    private String realName;

    @NotEmpty(message = "手机号码不能为空")
    @Pattern(regexp = ValidatorUtils.MOBILE, message = "手机号格式不正确")
    private String phone;

    @NotEmpty(message = "邮箱不能为空")
    @Email
    private String email;

    private String headImg;

    public UpdatePersonCenterDto() {
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public UserEntity updateData(UserEntity userEntity) {
        userEntity.setRealName(this.realName);
        userEntity.setPhone(this.phone);
        userEntity.setEmail(this.email);
        userEntity.setHeadImg(this.headImg);
        return userEntity;
    }

}
